<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<div data-index="5" data-first-name="greenhand_coder"></div>
<script>
  var div = document.querySelector('div');


  console.log(div.dataset.firstName);  // => greenhand_coder
  console.log(div.dataset.index);   // => 5
  console.log(div.dataset); // => DOMStringMap {index: "5", firstName: "greenhand_coder"}
</script>
</body>
</html>